home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 08 Nov 2000
- // Author: bwk
- //
- // Description:
- // This script initializes the Tool Settings. Initialization involves
- // determining the initial Tool Settings preferences, creating the UI
- // and setting the initial visibility.
- //
-
- proc createToolSettings(string $parent)
- //
- // Description:
- // Create the Tool Settings for within the main window
- //
- // Arguments:
- // parent - The parent layout. Must be a form layout.
- //
- {
- string $requiredType = "formLayout";
- if ($requiredType != `objectTypeUI $parent`) {
- error -showLineNumber true ("Argument must be a " + $requiredType);
- return;
- }
-
- global string $gToolSettingsMainWindowLocation;
- global string $gToolSettingsMainWindowIcon;
- global string $gToolSettingsMainWindowName;
- global string $gToolSettingsMainWindowResetButton;
- global string $gToolSettingsMainWindowHelpButton;
-
- setParent $parent;
-
- // Setting the width of this separator is the key to keeping the
- // Tool Settings window from varying it's width.
- //
- // Any tool that makes the settings area wider should be
- // reformatted.
- //
- // *** Note that the hardcoded value of 398 makes the
- // Tool Settings the same width as the Attribute Editor.
- //
- separator -style "none" -width 398;
-
- string $name = `text -label "" -align "left"`;
- string $reset = `button -label "Reset Tool"`;
- string $help = `button -label "Tool Help..."`;
-
- string $toolArea = `tabLayout
- -scrollable true
- -tabsVisible false
- -innerMarginWidth 2
- -innerMarginHeight 2
- `;
-
- columnLayout;
-
- formLayout -edit
- -attachForm $name "top" 1
- -attachForm $name "left" 1
- -attachControl $name "bottom" 5 $toolArea
- -attachNone $name "right"
-
- -attachForm $reset "top" 1
- -attachPosition $reset "left" 0 60
- -attachNone $reset "bottom"
- -attachPosition $reset "right" 3 80
-
- -attachForm $help "top" 1
- -attachPosition $help "left" 2 80
- -attachNone $help "bottom"
- -attachForm $help "right" 0
-
- -attachControl $toolArea "top" 2 $help
- -attachForm $toolArea "left" 0
- -attachForm $toolArea "bottom" 0
- -attachForm $toolArea "right" 0
- $parent;
-
-
- $gToolSettingsMainWindowLocation = $toolArea;
- $gToolSettingsMainWindowIcon = "";
- $gToolSettingsMainWindowName = $name;
- $gToolSettingsMainWindowResetButton = $reset;
- $gToolSettingsMainWindowHelpButton = $help;
- }
-
- global proc redirectToolSettings(string $destination)
- //
- // Description:
- // Redirect the location of the Tool Settings.
- //
- // This procedure will update the toolPropertyWindow
- // command so that it points to the correct controls
- // for displaying the Tool Settings.
- //
- // Arguments:
- // $destination - Either "Main Window" or "Separate Window".
- //
- {
- global string $gToolSettingsMainWindowLocation;
- global string $gToolSettingsMainWindowIcon;
- global string $gToolSettingsMainWindowName;
- global string $gToolSettingsMainWindowResetButton;
- global string $gToolSettingsMainWindowHelpButton;
-
- global string $gToolSettingsSeparateWindowLocation;
- global string $gToolSettingsSeparateWindowIcon;
- global string $gToolSettingsSeparateWindowName;
- global string $gToolSettingsSeparateWindowResetButton;
- global string $gToolSettingsSeparateWindowHelpButton;
-
- if ("Main Window" == $destination) {
- toolPropertyWindow -edit -location $gToolSettingsMainWindowLocation;
- toolPropertyWindow -edit -icon $gToolSettingsMainWindowIcon;
- toolPropertyWindow -edit -field $gToolSettingsMainWindowName;
- toolPropertyWindow -edit -resetButton $gToolSettingsMainWindowResetButton;
- toolPropertyWindow -edit -helpButton $gToolSettingsMainWindowHelpButton;
-
- } else if ("Separate Window" == $destination) {
- toolPropertyWindow -edit -location $gToolSettingsSeparateWindowLocation;
- toolPropertyWindow -edit -icon $gToolSettingsSeparateWindowIcon;
- toolPropertyWindow -edit -field $gToolSettingsSeparateWindowName;
- toolPropertyWindow -edit -resetButton $gToolSettingsSeparateWindowResetButton;
- toolPropertyWindow -edit -helpButton $gToolSettingsSeparateWindowHelpButton;
-
- } else if ("" == $destination) {
- toolPropertyWindow -edit -location "";
- toolPropertyWindow -edit -icon "";
- toolPropertyWindow -edit -field "";
- toolPropertyWindow -edit -resetButton "";
-
- } else {
- error ("Invalid destination for Tool Settings.");
- }
- }
-
- global proc int toolSettingsVisibilityStateChange(
- int $newState,
- string $layout)
- //
- // Description:
- // This procedure is called whenever the visibility state is changed.
- //
- // Arguments:
- // newState - The new visible state.
- //
- // layout - The parent layout.
- //
- // Returns:
- // true - If the change of state is to be allowed.
- //
- // false - If the state change is rejected.
- //
- {
- int $result = true;
-
- if ($newState) {
- redirectToolSettings("Main Window");
- } else {
- redirectToolSettings("");
- }
-
- // Defer these commands because this proc is called when the visibility
- // state is about to change. This proc must return true to accept
- // the state change. After this proc returns then restore the
- // panel focus and update the pref menu.
- //
- evalDeferred("restoreLastPanelWithFocus(); updatePrefsMenu();");
-
- return $result;
- }
-
- // Note that the following script block is not a procedure and will be
- // executed when this script file is sourced.
- //
- {
- global string $gToolSettingsForm;
-
- // Create the Tool Settings.
- //
- createToolSettings($gToolSettingsForm);
-
- setUIComponentStateCallback(
- "Tool Settings", "toolSettingsVisibilityStateChange");
-
- // Set the initial visibility.
- //
- setToolSettingsVisible(`optionVar -query toolSettingsVisible`);
- }
-